<script>
	export default {
		onLaunch: function() {
			wx.startLocationUpdate({
				success: function(resp) {
					console.log('开启定位成功')
				},
				fail: function(resp) {
					console.log('开启定位失败')
				}
			})
			// 实时更新当前的位置
			wx.onLocationChange(function(resp) {
				let latitude = resp.latitude;
				let longitude = resp.longitude;
				let location = {
					latitude: latitude,
					longitude: longitude
				};
				// 触发全局的自定义事件
				uni.$emit('updateLocation', location);
			})
		},
		onShow: function() {
			console.log('App Show');
		},
		onHide: function() {
			console.log('App Hide');
		}
	};
</script>

<style lang="scss">
	@import "uview-ui/index.scss";
</style>